The present invention relates to executing graph path queries. More specifically, the invention relates to storing the graphs in a relational database with separate node and edge tables and executing a path query on the graphs utilizing the database table structure.
A graph is generally represented by sets of nodes, also referred to herein as vertices, and edges connecting the nodes. Each edge or node in the graph may include one or more relation conditions. A graph path query is a data structure that indicates at least a source node, a target node, and one or more edges connecting the source and target nodes. Processing a graph query evaluates the conditions and through various techniques produces a final result set.
The graph may be stored in a relational database, with a node table and an edge table. The node table stores a node identifier with associated node attributes, and the edge table stores identifiers of two or more nodes that the edge connects together with associated edge attributes. The node and edge tables may be updated by adding or removing nodes and edges in the respective tables. A path query employs the node and edge tables to find a path with a size restriction between nodes having two qualifiers.